package com.qianli.dao;


import java.util.Iterator;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Restrictions;

import com.qianli.dao.core.BaseDao;
import com.qianli.dao.core.MatchType;
import com.qianli.pojo.Contact;
import com.qianli.pojo.Group;

public class ContactDao extends BaseDao<Contact,String> {
/*	
	public Contact update(String id,Contact contact) {
			Contact c=(Contact) getSession().get(Contact.class, id);			
		
			c.setName(contact.getName());
			System.out.println(c.getName());
			c.setTitle(contact.getTitle());
			c.setCompany(contact.getCompany());
			c.setLinkedin(contact.getLinkedin());
			c.setWeibo(contact.getWeibo());
			c.setInfo(contact.getInfo());
			getSession().update(c);
		return c;
	}*/
	public void del(String id){	
		
		Contact c=(Contact) getSession().get(Contact.class, id);
		 getSession().delete(c);
	
	}

	public List<Contact> findCon( String q_like_acronym) {
	
	
		Criteria c= getSession().createCriteria(Contact.class);
		c.add(Restrictions.like("acronym", q_like_acronym,MatchMode.START));
	
		return c.list();
		
	
	}
}
